<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "goods".
 *
 * @property int $goods_id 商品id
 * @property int $brand_id 品牌表关联ID
 * @property string $goods_name 商品名称
 * @property double $goods_price 商品总价格
 * @property double $goods_official_price 官方价格
 * @property double $goods_purchase_price 进货价格
 * @property string $cate_id 商品分类id,关联分类表
 * @property string $goods_tenancy_term 租期(多个用逗号分隔)
 * @property string $goods_sale_phone 售后电话
 * @property int $is_recom 是否推荐 0否1是
 * @property int $is_new 是否最新 0否1是
 * @property int $is_putaway 上架，1待提交 2待审核 3已上架 4下架 5驳回
 * @property int $is_delete 是否删除，0否1是
 * @property string $remarks 备注
 * @property string $detail 描述
 * @property string $goods_img_list 商品列表使用的图片
 * @property string $goods_order_thumbnail 订单缩略图
 * @property string $create_time 创建时间
 * @property string $cate_code 支付宝类目码(小程序使用),添加商品时由分类表传入
 * @property string $keyword 商品描述
 * @property int $is_required_insurance 1可选2比选
 * @property double $goods_insurance 商品意外保障费用
 * @property string $goods_date_due 商品多久归用户所有(月)
 * @property double $goods_installation_charge 安装包费用（元）
 * @property int $is_required 安装包是否必选  1否 2是
 * @property int $goods_num 排序
 * @property string $goods_installation_show 配件说明
 * @property int $is_synch 是否同步 1:是 2:否
 * @property double $monthly_rent 显示月租(前端展示给用户)
 * @property int $supplier_id 供应商表关联ID
 * @property string $supplier_name 供应商名称
 * @property int $click_uv 独立访问用户数
 * @property int $click_pv 页面访问量
 * @property int $order_count 下单总量
 */
class Goods extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'goods';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['brand_id', 'cate_id', 'is_recom', 'is_new', 'is_putaway', 'is_delete', 'is_required_insurance', 'goods_date_due', 'is_required', 'goods_num', 'is_synch', 'supplier_id', 'click_uv', 'click_pv', 'order_count'], 'integer'],
            [['goods_name', 'detail'], 'required'],
            [['goods_price', 'goods_official_price', 'goods_purchase_price', 'goods_insurance', 'goods_installation_charge', 'monthly_rent'], 'number'],
            [['detail'], 'string'],
            [['goods_name', 'goods_img_list', 'goods_order_thumbnail', 'keyword', 'goods_installation_show'], 'string', 'max' => 100],
            [['goods_tenancy_term'], 'string', 'max' => 50],
            [['goods_sale_phone', 'create_time', 'cate_code'], 'string', 'max' => 33],
            [['remarks'], 'string', 'max' => 200],
            [['supplier_name'], 'string', 'max' => 80],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'goods_id' => 'Goods ID',
            'brand_id' => 'Brand ID',
            'goods_name' => 'Goods Name',
            'goods_price' => 'Goods Price',
            'goods_official_price' => 'Goods Official Price',
            'goods_purchase_price' => 'Goods Purchase Price',
            'cate_id' => 'Cate ID',
            'goods_tenancy_term' => 'Goods Tenancy Term',
            'goods_sale_phone' => 'Goods Sale Phone',
            'is_recom' => 'Is Recom',
            'is_new' => 'Is New',
            'is_putaway' => 'Is Putaway',
            'is_delete' => 'Is Delete',
            'remarks' => 'Remarks',
            'detail' => 'Detail',
            'goods_img_list' => 'Goods Img List',
            'goods_order_thumbnail' => 'Goods Order Thumbnail',
            'create_time' => 'Create Time',
            'cate_code' => 'Cate Code',
            'keyword' => 'Keyword',
            'is_required_insurance' => 'Is Required Insurance',
            'goods_insurance' => 'Goods Insurance',
            'goods_date_due' => 'Goods Date Due',
            'goods_installation_charge' => 'Goods Installation Charge',
            'is_required' => 'Is Required',
            'goods_num' => 'Goods Num',
            'goods_installation_show' => 'Goods Installation Show',
            'is_synch' => 'Is Synch',
            'monthly_rent' => 'Monthly Rent',
            'supplier_id' => 'Supplier ID',
            'supplier_name' => 'Supplier Name',
            'click_uv' => 'Click Uv',
            'click_pv' => 'Click Pv',
            'order_count' => 'Order Count',
        ];
    }
}
